import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        while (T-- > 0) {
            int n = scanner.nextInt();
            long[] s = new long[n + 1]; // 前缀和数组，索引从1开始
            
            long a = Long.MAX_VALUE; // 初始化为极大值
            int l=n/2+1;
            for (int i = 1; i <= n; i++) {
                int x = scanner.nextInt();
                s[i] = s[i - 1] + x;
                if (i >= l) {
                    a = Math.min(a, s[i] - s[i - l]); // 计算最小差值
                }
            }
            System.out.println(a + " " + (s[n] - a));//是" " 不是""
        }
    }
}